﻿@model PagedList<Freeset>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <link href="/css/style.css" rel="stylesheet" type="text/css" />
    <link href="/css/select.css" rel="stylesheet" type="text/css" />
    <link href="/css/ladderinfostyle1.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="/js/jquery.js"></script>
    <script type="text/javascript" src="/js/jquery.idTabs.min.js"></script>
    <script type="text/javascript" src="/js/select-ui.min.js"></script>
    <script type="text/javascript">

        var api = {
            searchCustomer: '/user/FindByCustomerId',
            edit: "/commonset/FreeEdit",
            del: "/commonset/FreeDel"
        }


        function Search() {
            var customerId = $('#ul1').find("[name = 'CustomerNo']").val();
            $.post(api.searchCustomer, { customerId: customerId }, function (data) {
                if (data.Succeed) {
                    $('#ul1').find('[name="CustomerId"]').val(data.Obj.Id);
                    $('#ul1').find('[name="CustomerName"]').val(data.Obj.Name);

                } else {
                    alert(data.Msg);
                }

            }, 'json')
        }

        $(document).ready(function () {
 
            $('#form1').attr('action', api.edit);
            $('#form2').attr('action', api.edit);
             
            //减免添加
            $(".clickreductionfromadd").click(function () {
                $(".tipreductionfromadd").fadeIn(200);
            });

            $(".tiptopreductionfromadd a").click(function () {
                $(".tipreductionfromadd").fadeOut(200);
            });

            $(".surereductionfromadd").click(function () {
                $(".tipreductionfromadd").fadeOut(100);
            });

            $(".cancelreductionfromadd").click(function () {
                $(".tipreductionfromadd").fadeOut(100);
            });


            //减免修改
            $(".clickreductionfromchangemodify").click(function () {

                var count = $("input:checked").length;
                if (count < 1) {
                    alert("至少选择一项进行修改！");
                }
                else if (count > 1) {
                    alert("只能选择一项进行修改！");
                }
                else {
                    $(".tipreductionfromchangemodify").fadeIn(200);

                    $obj = $("input:checked").parents("tr");
                    $('#form2').find("input[name='Id']").val($obj.attr("Id"));

                    if ($obj.attr("WaterTypeId")) {
                        $('#form2').find("select[name='WaterTypeId']").find("option[value='" + $obj.attr("WaterTypeId") + "']").attr("selected", true);
                        $('#form2').find("select[name='WaterTypeId']").prev().find("em:first").text($('#form2').find("select[name='WaterTypeId']").find("option:selected").text());
                    }

                    $('#form2').find("input[name='START']").val($obj.attr("START"));
                    $('#form2').find("input[name='EndTo']").val($obj.attr("EndTo"));
                    $('#form2').find("input[name='Price']").val($obj.attr("Price"));
                    $('#form2').find("input[name='DESCRIPTION']").val($obj.attr("DESCRIPTION"));
                }


              //  $(".tipreductionfromchangemodify").fadeIn(200);
            });

            $(".tiptopreductionfromchangemodify a").click(function () {
                $(".tipreductionfromchangemodify").fadeOut(200);
            });

            $(".surereductionfromchangemodify").click(function () {
                $(".tipreductionfromchangemodify").fadeOut(100);
            });

            $(".cancelreductionfromchangemodify").click(function () {
                $(".tipreductionfromchangemodify").fadeOut(100);
            });


            //减免查询
            $(".clickfromchangesearch").click(function () {
                $(".tipfromchangesearch").fadeIn(200);
            });

            $(".tiptopfromchangesearch a").click(function () {
                $(".tipfromchangesearch").fadeOut(200);
            });

            $(".surefromchangesearch").click(function () {
                $(".tipfromchangesearch").fadeOut(100);
            });

            $(".cancelfromchangesearch").click(function () {
                $(".tipfromchangesearch").fadeOut(100);
            });

            //删除用户
            $(".clickdel").click(function (del) {
                $(".tipdel").fadeIn(200);
            });

            $(".tiptopdel a").click(function (del) {
                $(".tipdel").fadeOut(200);
            });

            $(".suredel").click(function (del) {
                $(".tipdel").fadeOut(100);
            });

            $(".canceldel").click(function (del) {
                $(".tipdel").fadeOut(100);
            });

        });
    </script>
    <script type="text/javascript">
        $(document).ready(function (e) {
            $(".select1").uedSelect({
                width: 345
            });
            $(".select2").uedSelect({
                width: 167
            });
            $(".select3").uedSelect({
                width: 150
            });
        });
    </script>
</head>
<body>
    <div class="place">
        <span>位置：</span>
        <ul class="placeul">
            <li><a href="#">首页</a></li>
            <li><a href="#">基本设置管理</a></li>
            <li><a href="#">减免设置</a></li>
        </ul>
    </div>
    <div class="rightinfo">
        <div class="tools">
            <ul class="toolbar">
                <li class="clickreductionfromadd"><span><img src="/images/t01a.png" /></span>添加</li>
                <li class="clickreductionfromchangemodify"><span><img src="/images/t02.png" /></span>修改</li>
                <li class="clickdel"><span><img src="/images/t03.png" /></span>删除</li>
                <li class="clickfromchangesearch"><span><img src="/images/t10.png" /></span>查询</li>
                <li class="clickfrom"><span><img src="/images/t09.png" /></span>导出</li>

            </ul>

        </div>
        <table class="imgtable">
            <thead>
                <tr>
                    <th>选择</th>
                    <th>用户编号</th>
                    <th>用户姓名</th>
                    <th>居住区域</th>
                    <th>详细地址</th>
                    <th>减免类型</th>
                    <th>减免方式</th>
                    <th>减免期限</th>
                    <th>减免金额（元）</th>
                    <th>减免次数</th>
                    <th>减免用量</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model)
                {
                    <tr jsonModel="@(JsonConvert.SerializeObject(item,new JsonSerializerSettings{ReferenceLoopHandling = ReferenceLoopHandling.Ignore}))">
                        <td><input name="" type="checkbox" value="@(item.Id)" /></td> 
                        <td>@(item.Customer.CustomerId)</td>
                        <td height="30px;">@(item.Customer.CustomerName)</td>
                        <td>@(item.FirstArea)@(item.SecondArea)</td>
                        <td>@(item.DetailAddress)</td>
                        <td>@(((Freeset.DefaultFreeTypeEnum)item.defaultExecuteType).ToDescription())</td>
                        <td>@(((Freeset.FreeMethodEnum)item.FreeMethod).ToDescription())</td>
                        <td>@(((Freeset.FreeLimitEnum)item.FreeLimit).ToDescription())</td>
                        <td>@(item?.FreeMoney)</td>
                        <td>@(item?.FreeTimes)</td>
                        <td>@(item?.FreeWaterMuch)</td>
                    </tr> 
                }  
            </tbody>
        </table>
        <div class="pagin">
            <div class="message">共<i class="blue">@(Model.TotalItemCount)</i>条记录，共&nbsp;<i class="blue">@(Model.TotalPageCount)&nbsp;</i>页</div>
            @Html.Pager(Model, BaseController.PagerOptions)
        </div>





        <form  method="post" id="form1">
            <div class="tipreductionfromadd">
                <div class="tiptopreductionfromadd"><img src="/images/t06.png" /><span>添加减免用户</span><a></a></div>
                <div class="tipinforeductionfromadd">
                    <div class="userinfozbreductionfromadd">
                        <dt class="userinfozbtitreductionfromadd">减免用户信息</dt>
                        <ul class="seachform" id="ul1">
                            <li>
                                <label>用户编号</label>
                                <input name="CustomerNo" type="text" class="scinput" onblur="Search();" />
                                <input name="CustomerId" type="hidden" class="scinput"/>
                            </li>

                            <li>
                                <label>用户姓名</label>
                                <input name="CustomerName" type="text" class="scinput" />
                            </li>

                            @Html.Action("_LinkArea", "Common")
                            <li>
                                <label>详细地址</label>
                                <input name="DetailAddress" type="text" class="scinput" />
                            </li>
                        </ul>
                    </div>
                    <!--按金额减免开始-->
                    <div class="userinfozbreductionfromadd">
                        <dt class="userinfozbtitreductionfromadda">按金额减免</dt>
                        <ul class="seachform">

                            <li>
                                <label>减免方式</label>
                                <div class="vocation">
                                    @Html.Action("_EnumSelect", "Common", new { className = "Freeset+FreeMethodEnum", namespaces = "Kongt.Model", name = "FreeMethod", cssClass = "select3" })
                                </div>
                            </li>

                            <li>
                                <label>减免金额</label>
                                <input name="FreeMoney" type="text" class="scinput" />
                            </li>

                            <li>
                                <label>减免期限</label>
                                <div class="vocation">
                                    @Html.Action("_EnumSelect", "Common", new { className = "Freeset+FreeLimitEnum", namespaces = "Kongt.Model", name = "FreeLimit", cssClass = "select3" })
                                </div>
                            </li>

                            <li>
                                <label>减免次数</label>
                                <input name="FreeTimes" type="text" class="scinput" />
                            </li>
                        </ul>
                    </div>
                    <!--按金额减免结束-->
                    <!--按用水量减免开始-->
                    <div class="userinfozbreductionfromadd">
                        <dt class="userinfozbtitreductionfromaddb">按用水量减免</dt>
                        <ul class="seachform">
                            <li>
                                <label>减免方式</label>
                                <div class="vocation">
                                    @Html.Action("_EnumSelect", "Common", new { className = "Freeset+FreeMethodEnum", namespaces = "Kongt.Model", name = "FreeMethod1", cssClass = "select3" })
                                </div>
                            </li>
                            <li>
                                <label>减免用量</label>
                                <input name="FreeWaterMuch" type="text" class="scinput" />
                            </li>

                            <li>
                                <label>减免期限</label>
                                <div class="vocation">
                                    @Html.Action("_EnumSelect", "Common", new { className = "Freeset+FreeLimitEnum", namespaces = "Kongt.Model", name = "FreeLimit1", cssClass = "select3" })
                                </div>
                            </li>

                            <li>
                                <label>减免次数</label>
                                <input name="FreeTimes1" type="text" class="scinput" />
                            </li>
                        </ul>
                    </div>
                    <!--按用水量减免结束-->
                    <!--默认减免类型开始-->
                    <div class="userinfozbreductionfromaddxz">
                        <ul class="seachform">
                            <li>
                                <label>默认减免类型</label>
                                <div class="vocation">
                                    @Html.Action("_EnumSelect", "Common", new { className = "Freeset+DefaultFreeTypeEnum", namespaces = "Kongt.Model", name = "defaultExecuteType", cssClass = "select3" })
                                </div>
                                <dt class="redbx">* 减免时，必选一项!</dt>
                            </li>
                        </ul>
                    </div>
                    <!--默认减免类型结束-->


                </div>
                <div class="tipbtnreductionfromadd">
                    <input name="" type="submit" class="surereductionfromadd" value="添加" />
                    &nbsp;
                    <input name="" type="button" class="cancelreductionfromadd" value="取消" />
                </div>
            </div> 
        </form>




        <!--删除用户-->
        <div class="tipdel">
            <div class="tiptopdel"><span>提示信息</span><a></a></div>
            <div class="tipinfodel">
                <span><img src="/images/ticon01.png" /></span>
                <div class="tiprightdel">
                    <p>确定要删除【<font color="#ff0000">GL01021</font>】阶梯水价吗？</p>
                    <cite>如果是请点击确定按钮 ，否则请点取消。</cite>
                </div>
            </div>
            <div class="tipbtndel">
                <input name="" type="button" class="suredel" value="确定" />
                &nbsp;
                <input name="" type="button" class="canceldel" value="取消" />
            </div>
        </div>

        <form method="post" id="form2">
            <!--减免用户修改-->
            <div class="tipreductionfromchangemodify">
                <div class="tiptopreductionfromchangemodify"><img src="/images/t06.png" /><span>减免用户修改</span><a></a></div>
                <div class="tipinforeductionfromadd">
                    <div class="userinfozbreductionfromadd">
                        <dt class="userinfozbtitreductionfromadd">减免用户信息</dt>
                        <ul class="seachform">
                            <li>
                                <label>用户编号</label>
                                <input name="" type="text" class="scinput" />
                            </li>

                            <li>
                                <label>用户姓名</label>
                                <input name="" type="text" class="scinput" />
                            </li>

                            <li class="qx">
                                <label>区域分布</label>
                                <input name="" type="text" class="scinput" />
                            </li>
                            <li>
                                <label>详细地址</label>
                                <input name="" type="text" class="scinput" />
                            </li>
                        </ul>
                    </div>
                    <!--按金额减免开始-->
                    <div class="userinfozbreductionfromadd">
                        <dt class="userinfozbtitreductionfromadda">按金额减免</dt>
                        <ul class="seachform">
                            <li>
                                <label>减免方式</label>
                                <div class="vocation">
                                    <select class="select3">
                                        <option>------请选择------</option>
                                        <option>全部减免</option>
                                        <option>部分减免</option>
                                    </select>
                                </div>
                            </li>
                            <li>
                                <label>减免金额</label>
                                <input name="" type="text" class="scinput" />
                            </li>

                            <li class="qx">
                                <label>减免期限</label>
                                <div class="vocation">
                                    <select class="select3">
                                        <option>------请选择------</option>
                                        <option>永久减免</option>
                                        <option>次数减免</option>
                                    </select>
                                </div>
                            </li>

                            <li>
                                <label>减免次数</label>
                                <input name="" type="text" class="scinput" />
                            </li>
                        </ul>
                    </div>
                    <!--按金额减免结束-->
                    <!--按用水量减免开始-->
                    <div class="userinfozbreductionfromadd">
                        <dt class="userinfozbtitreductionfromaddb">按用水量减免</dt>
                        <ul class="seachform">
                            <li>
                                <label>减免方式</label>
                                <div class="vocation">
                                    <select class="select3">
                                        <option>------请选择------</option>
                                        <option>全部减免</option>
                                        <option>部分减免</option>
                                    </select>
                                </div>
                            </li>
                            <li>
                                <label>减免用量</label>
                                <input name="" type="text" class="scinput" />
                            </li>

                            <li class="qx">
                                <label>减免期限</label>
                                <div class="vocation">
                                    <select class="select3">
                                        <option>------请选择------</option>
                                        <option>永久减免</option>
                                        <option>次数减免</option>
                                    </select>
                                </div>
                            </li>

                            <li>
                                <label>减免次数</label>
                                <input name="" type="text" class="scinput" />
                            </li>
                        </ul>
                    </div>
                    <!--按用水量减免结束-->
                    <!--默认减免类型开始-->
                    <div class="userinfozbreductionfromaddxz">
                        <ul class="seachform">
                            <li>
                                <label>默认减免类型</label>
                                <div class="vocation">
                                    <select class="select3">
                                        <option>------请选择------</option>
                                        <option>按金额减免</option>
                                        <option>按用水量减免</option>
                                    </select>
                                </div><dt class="redbx">* 减免时，必选一项!</dt>

                            </li>
                        </ul>
                    </div>
                    <!--默认减免类型结束-->
                </div>
                <div class="tipbtnreductionfromchangemodify">
                    <input name="" type="button" class="surereductionfromchangemodify" value="确定" />
                    &nbsp;
                    <input name="" type="button" class="cancelreductionfromchangemodify" value="取消" />
                </div>
            </div>
        </form>
            <!--减免查询-->
            <div class="tipfromchangesearch">
                <div class="tiptopfromchangesearch"><img src="/images/t06.png" /><span>减免查询</span><a></a></div>
                <div class="tipinfofromchangesearch">
                    <div class="tiprightfromchangesearch">
                        <dt class="userinfotitfromchangesearch">请输入查询条件</dt>
                        <ul class="seachform">
                            <li>
                                <label>用户编号</label>
                                <input name="" type="text" class="scinput" />
                            </li>
                            <li>
                                <label>用户姓名</label>
                                <input name="" type="text" class="scinput" />
                            </li>
                            <li>
                                <label>水表编号</label>
                                <input name="" type="text" class="scinput" />
                            </li>
                            <li>
                                <label>区域分布</label>
                                <div class="vocation">
                                    <select class="select3">
                                        <option>一级区域</option>
                                        <option>中上线</option>
                                        <option>中下线</option>
                                        <option>东线</option>
                                        <option>西线</option>
                                        <option>中下线平房</option>
                                        <option>东线平房</option>
                                        <option>西线平房</option>
                                    </select>
                                </div>
                            </li>
                            <li>
                                <label>区域名称</label>
                                <div class="vocation">
                                    <select class="select3">
                                        <option>二级区域</option>
                                        <option>东路工行</option>
                                        <option>图书馆</option>
                                        <option>科协</option>
                                        <option>传输局</option>
                                    </select>
                                </div>
                            </li>
                            <li>
                                <label>详细地址</label>
                                <input name="" type="text" class="scinput" />
                            </li>
                            <li class="aclear">
                                <label>减免日期</label>
                                <div class="vocation">
                                    <select class="select3">
                                        <option>2017年2月10日</option>

                                    </select>
                                </div>
                            </li>
                            <li>
                                <label>为止日期</label>
                                <div class="vocation">
                                    <select class="select3">
                                        <option>2017年2月10日</option>
                                    </select>
                                </div>
                            </li>
                            <li>
                                <label>减免类型</label>
                                <div class="vocation">
                                    <select class="select3">
                                        <option>------请选择------</option>
                                        <option>按金额减免</option>
                                        <option>按用水量减免</option>
                                    </select>
                                </div>
                            </li>


                        </ul>
                    </div>
                </div>
                <div class="tipbtnfromchangesearch">
                    <input name="" type="button" class="surefromchangesearch" value="添加" />
                    &nbsp;
                    <input name="" type="button" class="cancelfromchangesearch" value="取消" />
                </div>
            </div>

            <script type="text/javascript">
                $('.tablelist tbody tr:odd').addClass('odd');
            </script>
        </form></div>
</body>
</html>
